import { axios } from '@/utils/request'

export const getDictCache = codeList => {
  return axios({
    url: 'dict/cache',
    method: 'post',
    data: codeList
  })
}

export const getDictPage = (typeCode, params) => {
  return axios({
    url: 'dict/type/' + typeCode,
    method: 'get',
    params
  })
}

export const saveDict = (typeCode, data) => {
  return axios({
    url: 'dict/type/' + typeCode,
    method: 'post',
    data
  })
}

export const getDictById = (typeCode, code) => {
  return axios({
    url: 'dict/' + code + '/type/' + typeCode,
    method: 'get'
  })
}

export const updateDictById = (typeCode, code, data) => {
  return axios({
    url: 'dict/' + code + '/type/' + typeCode,
    method: 'put',
    data
  })
}

export const removeDictById = (typeCode, code) => {
  return axios({
    url: 'dict/' + code + '/type/' + typeCode,
    method: 'delete'
  })
}
